import React, { memo, useEffect } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import MyTable from '@/components/my-table/mytable';
import { changeRolesAction } from '../../store/actionCreators';
/* 角色界面 */
export default memo(function Role() {
  /* 执行redux更改数据 获取数据传入表格组件 */
  const dispatch = useDispatch();
  const { rolesList } = useSelector(
    (state) => ({
      rolesList: state.getIn(['index', 'rolesList']),
    }),
    shallowEqual,
  );

  console.log(rolesList);

  useEffect(() => {
    dispatch(changeRolesAction());
  }, [dispatch]);
  return (
    <div>
      <MyTable dataList={rolesList} />
    </div>
  );
});
